import { IFeidaoAiBrowserComponent } from '@feidao/web/interfaces';

export default async function a003(fd: IFeidaoAiBrowserComponent, ...args: any[]) {
	// 确定
	const boxs = fd.data.node.querySelectorAll('[data-feidao-name="exam"]:checked');
	if (boxs.length === 0) {
		alert('请选择考场');
		return;
	}
	let total_num = 0;
	const ids: string[] = [];
	const cs: number[] = [];
	Array.from(boxs).forEach((ipt: HTMLInputElement) => {
		const id = ipt.getAttribute('data-feidao-id');
		ids.push(id);
		const c = ipt.getAttribute('data-feidao-c');
		total_num = total_num + parseInt(c);
		cs.push(parseInt(c));
	});
	const exam_subjects_id = fd.data.exam_subjects_id;
	const total_people = fd.data.total_people;
	if (total_num < total_people) {
		alert('考场容纳量不能小于考生数量');
		return;
	} else if (total_num > total_people) {
		const c = total_num - total_people;
		const chk = cs.filter((i) => {
			return c > i;
		});
		if (chk.length > 0) {
			alert('请合理的选择考场');
			return;
		}
		// 调用服务

	}
}
